<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<title>商品类别信息</title>
 <%@ include file="/page/include.jsp" %>
</head>
<link rel="stylesheet" type="text/css" href="${rootPath}/statics/plugins/zTree/css/zTreeStyle/zTreeStyle.css" />
<style type="text/css">
.error {
	color: red;
	padding-left: 10px;
}
</style>
<body class="nav-md" style="background-color: #f7f7f7">
	<div class="container body">
		<div class="main_container">
			<div class="framebody" style="min-height: 100%;" role="main">
				<div class="row">
					<div class="col-md-12 col-sm-12 col-xs-12">
						<div class="x_panel">
							<div class="x_content">
								<form class="form-horizontal form-label-left"
									id="productCategoryForm" method="post"
									action="${pageContext.request.contextPath}/productCategory/saveOrUpdateProductCategory">
									<input type="hidden" id="id" name="id"
										value="${productCategory.id }">
									<div class="item form-group">
										<label class="control-label form-item-label" for="roleName">上级分类:
										</label>
										<div class="col-md-5 col-sm-5 col-xs-12">
											<select id="parentCategoryId" name="parentCategoryId"
												value="${productCategory.parentCategoryId }"
												class="selectpicker form-control col-md-3 col-xs-12"
												title="请选择"
												<c:if test="${opFlag eq 'edit' }">data-live-search="true"</c:if>>
												<c:if test="${opFlag eq 'add' }">
													<option value="${parentCategoryId }" selected>${parentCategoryName }</option>
												</c:if>
												<c:if test="${opFlag eq 'edit' }">
													<option value="0"
														<c:if test="${productCategory.parentCategoryId == 0 }">selected</c:if>>根节点</option>
													<c:forEach var="item" items="${productCategoryList }"
														varStatus="status">
														<option value="${item.id }"
															<c:if test="${item.id == productCategory.parentCategoryId}">selected</c:if>>${item.categoryName }</option>
													</c:forEach>
												</c:if>
											</select>
										</div>
									</div>
									<div class="item form-group">
										<label class="control-label form-item-label" for="roleName">分类名称
											: </label>
										<div class="col-md-5 col-sm-5 col-xs-12">
											<input id="categoryName" name="categoryName" value="${productCategory.categoryName }"
												class="form-control col-md-3 col-xs-12" type="text">
										</div>
									</div>
									<%-- <div class="item form-group">
										<label class="control-label form-item-label" for="roleName">排序:
										</label>
										<div class="col-md-5 col-sm-5 col-xs-12">
											<input id="sortNo" name="sortNo"
												value="${productCategory.sortNo }"
												class="form-control col-md-3 col-xs-12" type="text">
										</div>
									</div> --%>
									<div class="item form-group">
										<label class="control-label form-item-label" for="roleName">图标
											: </label>
										<div class="col-md-5 col-sm-5 col-xs-12">
											<div class="uploadpic_part">
												<ul class="image_container">
													<li ${productCategory.categoryImage != null ? 'style="display: none;"' : '' }>
														<div class="pic1">
															<img src="${rootPath }/statics/images/upload_pic1.png" />
															<input id="upload_category_image" type="file"
																name="imagePath" onchange="ajaxFileUpload(this)" />
														</div>
													</li>
													<c:if test="${productCategory.categoryImage != null}">
														<li>
															<div class="pic1">
																<a rel="categoryIconImg" href="<%=PublicConfig.IMG_ROOT_URL%>${productCategory.categoryImage }">
																	<img src="<%=PublicConfig.IMG_ROOT_URL%>${productCategory.categoryImage }?x-oss-process=image/resize,h_60/format,png" />
																</a>
																<a id="btn_close" href="javascript:void(0)" class="icon_close"></a> 
																<input type="hidden" name="categoryImage" value="${productCategory.categoryImage}" />
															</div>
														</li>
													</c:if>
												</ul>
											</div>
											<span class="pictips">建议尺寸：80*80PX，单张大小不超过1M</span>
										</div>
									</div>
									
									<div class="item form-group">
										<label class="control-label form-item-label" for="roleName">广告路径 : </label>
										<div class="col-md-5 col-sm-5 col-xs-12">
											<input id="advertisementUrl" name="advertisementUrl" value="${productCategory.advertisementUrl }"
												class="form-control col-md-3 col-xs-12" type="text">
										</div>
									</div>
									<div class="item form-group">
										<label class="control-label form-item-label" for="roleName">广告图片: </label>
										<div class="col-md-5 col-sm-5 col-xs-12">
											<div class="uploadpic_part">
												<ul class="image_container">
													<li ${productCategory.advertisementImage != null ? 'style="display: none;"' : '' }>
														<div class="pic1">
															<img src="${rootPath }/statics/images/upload_pic1.png" />
															<input id="upload_advertisement_image" type="file" name="imagePath" onchange="ajaxFileUpload(this)" />
														</div>
													</li>
													<c:if test="${productCategory.advertisementImage != null}">
														<li>
															<div class="pic1">
																<a rel="adverteImg" href="<%=PublicConfig.IMG_ROOT_URL%>${productCategory.advertisementImage }">
																	<img src="<%=PublicConfig.IMG_ROOT_URL%>${productCategory.advertisementImage }?x-oss-process=image/resize,h_60/format,png" />
																</a>
																<a id="btn_close" href="javascript:void(0)" class="icon_close"></a> 
																<input type="hidden" name="advertisementImage" value="${productCategory.advertisementImage}" />
															</div>
														</li>
													</c:if>
												</ul>
											</div>
											<span class="pictips">建议尺寸：800*800PX，单张大小不超过1M</span>
										</div>
									</div>
								</form>
								<div class="ln_solid"></div>
								<div class="form-btn-content">
									<a id="btn_save" class="btn btn-primary">确定</a> <a
										id="btn_back" class="btn btn-default">返回</a>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>

	<script type="text/javascript" src="${rootPath }/statics/plugins/upload/ajaxfileupload.js"></script>
   <script type="text/javascript"  src="${rootPath}/js/product/productCategory_form.js"></script>
  </body>
</html>